<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Model\Books;

class BooksController extends Controller
{
    public function index(){
    	$books = new Books;
    	$data['booksCount'] = $books->count();
    	$data['booksData'] = $books->leftJoin('category','books.cid','=','category.id')->select('books.*','category.name')->orderBy('id','desc')->paginate(10);

    	return view('admin.books_list',$data);
    }
}
